import request from '@/utils/request'

// 查询客户分群列表
export function listCustomerGroup(query) {
  return request({
    url: '/prod-api/customer/CustomerGroup/list',
    method: 'get',
    params: query
  })
}

// 查询客户分群详细
export function getCustomerGroup(groupUid) {
  return request({
    url: '/prod-api/customer/CustomerGroup/' + groupUid,
    method: 'get'
  })
}

// 新增客户分群
export function addCustomerGroup(data) {
  return request({
    url: '/prod-api/customer/CustomerGroup',
    method: 'post',
    data: data
  })
}

// 修改客户分群
export function updateCustomerGroup(data) {
  return request({
    url: '/prod-api/customer/CustomerGroup',
    method: 'put',
    data: data
  })
}

// 删除客户分群
export function delCustomerGroup(groupUid) {
  return request({
    url: '/prod-api/customer/CustomerGroup/' + groupUid,
    method: 'delete'
  })
}

// 根据条件查询客户信息
export function selectGroupCustomerInfo(groupDefinitionInfoQuerie) {
  return request({
    url: '/prod-api/customer/CustomerGroup/selectGroupCustomerInfo',
    method: 'post',
    data: groupDefinitionInfoQuerie
  })
}

// 新增人群分组
export function addGroup(data) {
  console.log(data)
  return request({
    url: '/prod-api/customer/CustomerGroup/addGroup',
    method: 'post',
    data: data
  })
}

// 修改人群分组
export function editGroup(customerGroupVo) {
  return request({
    url: '/prod-api/customer/CustomerGroup/editGroup',
    method: 'post',
    data: customerGroupVo
  })
}

/**
 * 查看分群名称简介列表
 */
export function getGroupInfo() {
  return request({
    url: '/prod-api/customer/CustomerGroup/getGroupInfo',
    method: 'get'
  })
}

/**
 * 查看指定分群名称及人数
 */
export function getGroupInfoById(groupUid) {
  return request({
    url: '/prod-api/customer/CustomerGroup/getGroupInfoById/' + groupUid,
    method: 'get'
  })
}
